summaryrefslogtreecommitdiff
path: root/app/[lng]
diff options
context:
space:
mode:
Diffstat (limited to 'app/[lng]')
-rw-r--r--app/[lng]/partners/(partners)/swp-document-upload/vendor-document-page.tsx29
1 files changed, 29 insertions, 0 deletions
diff --git a/app/[lng]/partners/(partners)/swp-document-upload/vendor-document-page.tsx b/app/[lng]/partners/(partners)/swp-document-upload/vendor-document-page.tsx
index dc6fbe7c..34ad562f 100644
--- a/app/[lng]/partners/(partners)/swp-document-upload/vendor-document-page.tsx
+++ b/app/[lng]/partners/(partners)/swp-document-upload/vendor-document-page.tsx
@@ -70,6 +70,34 @@ export default function VendorDocumentPage({ searchParams }: VendorDocumentPageP
noKeyboard: true,
});
+ // 커버페이지 다운로드 핸들러
+ const handleCoverDownload = useCallback(async (document: DocumentListItem) => {
+ try {
+ toast.info("커버 페이지를 다운로드합니다...");
+
+ const res = await fetch(`/api/projects/${document.PROJ_NO}/cover`, {
+ method: "GET"
+ });
+
+ if (!res.ok) {
+ const error = await res.json();
+ throw new Error(error.message || "커버 페이지를 가져올 수 없습니다");
+ }
+
+ const { fileUrl, fileName } = await res.json();
+
+ // quickDownload 사용
+ const quickDownload = (await import("@/lib/file-download")).quickDownload;
+ quickDownload(fileUrl, fileName || `${document.PROJ_NO}_cover.docx`);
+
+ toast.success("커버 페이지 다운로드를 시작했습니다.");
+
+ } catch (e) {
+ toast.error(e instanceof Error ? e.message : "커버 페이지 다운로드에 실패했습니다.");
+ console.error(e);
+ }
+ }, []);
+
const loadInitialData = useCallback(async () => {
try {
setIsLoading(true);
@@ -275,6 +303,7 @@ export default function VendorDocumentPage({ searchParams }: VendorDocumentPageP
projNo={projNo}
vendorCode={vendorInfo?.vendorCode || ""}
userId={String(vendorInfo?.vendorId || "")}
+ onCoverDownload={handleCoverDownload}
/>
</CardContent>
</Card>